<?php

namespace App\Notifications\OrderNotifications;

use App\Common\Constant\Params;
use App\Models\Master;
use App\Models\Merchant;
use App\Models\Order;
use App\Models\OrderRefund;
use App\Notifications\Channels\SmsChannel;
use App\Notifications\OrderNotification;
use App\Services\IMasterService;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class MerchantOrderArbitrateNotification extends Notification implements OrderNotification
{
    use Queueable;

    private $refund;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct(OrderRefund $refund)
    {
        $this->refund = $refund;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['database'];
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray(Master $master)
    {
        $message = <<<EOT
%s师傅，您好！您服务的订单%s，下单用户向平台申请仲裁，客服将介入双方纠纷进行调查仲裁。如有问题建议您与下单用户进行沟通协商。
EOT;
        $message = sprintf($message,
            $master->real_name,
            $this->refund->order->order_number);
        return [
            'title'=>'下单用户申请仲裁提醒',
            'order_id'=>$this->refund->order->id,
            'message'=>$message
        ];
    }
}
